﻿@namespace Masa.Blazor
@inherits Masa.Blazor.Components.ItemGroup.MGroupableBase<MExpansionPanels>

<CascadingValue Value="this" IsFixed>
    <div class="@GetClass()"
         style="@GetStyle()"
         id="@Id"
         @ref="Ref"
         @attributes="@Attributes">
        @GenTitle()
        @GenText()
        @ChildContent
    </div>
</CascadingValue>

@code {

    private RenderFragment GenTitle() => __builder =>
    {
        if (!string.IsNullOrWhiteSpace(Title))
        {
            <MExpansionPanelHeader>@Title</MExpansionPanelHeader>
        }
    };


    private RenderFragment GenText() => __builder =>
    {
        if (!string.IsNullOrWhiteSpace(Text))
        {
            <MExpansionPanelContent>@Text</MExpansionPanelContent>
        }
    };

}